using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JGSY.CMS.LowCode.Platform.Application.DTOs;

namespace JGSY.CMS.LowCode.Platform.Application.Interfaces
{
    /// <summary>
    /// 语言应用服务接口
    /// 提供多语言管理的业务逻辑
    /// </summary>
    public interface ILanguageAppService
    {
        /// <summary>
        /// 获取分页的语言列表
        /// </summary>
        /// <param name="query">查询参数</param>
        /// <returns>分页的语言列表</returns>
        Task<PagedResultDto<LanguageDto>> GetPagedListAsync(PagedQueryDto query);
        
        /// <summary>
        /// 获取所有可用语言
        /// </summary>
        /// <param name="includeDisabled">是否包含禁用的语言</param>
        /// <returns>语言列表</returns>
        Task<List<LanguageDto>> GetAllAsync(bool includeDisabled = false);
        
        /// <summary>
        /// 获取前端显示的语言列表
        /// </summary>
        /// <returns>前端语言列表</returns>
        Task<List<LanguageDto>> GetFrontendLanguagesAsync();
        
        /// <summary>
        /// 根据ID获取语言详情
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>语言详情</returns>
        Task<LanguageDto?> GetByIdAsync(long id);
        
        /// <summary>
        /// 根据代码获取语言
        /// </summary>
        /// <param name="code">语言代码</param>
        /// <returns>语言信息</returns>
        Task<LanguageDto?> GetByCodeAsync(string code);
        
        /// <summary>
        /// 获取默认语言
        /// </summary>
        /// <returns>默认语言</returns>
        Task<LanguageDto?> GetDefaultLanguageAsync();
        
        /// <summary>
        /// 创建语言
        /// </summary>
        /// <param name="dto">语言数据</param>
        /// <returns>创建的语言</returns>
        Task<LanguageDto> CreateAsync(LanguageDto dto);
        
        /// <summary>
        /// 更新语言
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <param name="dto">更新的语言数据</param>
        /// <returns>更新后的语言</returns>
        Task<LanguageDto> UpdateAsync(Guid id, LanguageDto dto);
        
        /// <summary>
        /// 删除语言
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>删除结果</returns>
        Task<bool> DeleteAsync(Guid id);
        
        /// <summary>
        /// 批量删除语言
        /// </summary>
        /// <param name="ids">语言ID列表</param>
        /// <returns>删除结果</returns>
        Task<bool> BatchDeleteAsync(List<Guid> ids);
        
        /// <summary>
        /// 设置默认语言
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>设置结果</returns>
        Task<bool> SetDefaultAsync(Guid id);
        
        /// <summary>
        /// 启用/禁用语言
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <param name="enabled">是否启用</param>
        /// <returns>操作结果</returns>
        Task<bool> SetEnabledAsync(Guid id, bool enabled);
        
        /// <summary>
        /// 批量更新排序权重
        /// </summary>
        /// <param name="sortData">排序数据</param>
        /// <returns>更新结果</returns>
        Task<bool> BatchUpdateSortAsync(Dictionary<Guid, int> sortData);
        
        /// <summary>
        /// 更新翻译进度
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>更新结果</returns>
        Task<bool> UpdateTranslationProgressAsync(Guid id);
        
        /// <summary>
        /// 检查语言代码是否存在
        /// </summary>
        /// <param name="code">语言代码</param>
        /// <param name="excludeId">排除的语言ID</param>
        /// <returns>是否存在</returns>
        Task<bool> ExistsAsync(string code, Guid? excludeId = null);
        
        /// <summary>
        /// 获取语言统计信息
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>统计信息</returns>
        Task<Dictionary<string, int>> GetStatisticsAsync(Guid id);
        
        /// <summary>
        /// 导出语言配置
        /// </summary>
        /// <param name="id">语言ID</param>
        /// <returns>导出数据</returns>
        Task<byte[]> ExportAsync(Guid id);
        
        /// <summary>
        /// 导入语言配置
        /// </summary>
        /// <param name="data">导入数据</param>
        /// <returns>导入结果</returns>
        Task<LanguageDto> ImportAsync(byte[] data);
        
        /// <summary>
        /// 复制语言
        /// </summary>
        /// <param name="id">原语言ID</param>
        /// <param name="newCode">新语言代码</param>
        /// <param name="newName">新语言名称</param>
        /// <returns>复制的语言</returns>
        Task<LanguageDto> CopyAsync(Guid id, string newCode, string newName);
        
        /// <summary>
        /// 同步翻译数据
        /// </summary>
        /// <param name="sourceLanguageId">源语言ID</param>
        /// <param name="targetLanguageId">目标语言ID</param>
        /// <returns>同步结果</returns>
        Task<bool> SyncTranslationsAsync(Guid sourceLanguageId, Guid targetLanguageId);
    }
}
